<template>
  <div class="contact">
    <div class="hero">
      <h1>联系我们</h1>
      <p>如果您有任何问题或建议，请随时与我们联系。我们期待您的反馈，并将尽快回复您！</p>
    </div>
    
    <div class="section">
      <div class="grid grid--2-cols">
        <AdvancedCard class="contact-info-card">
          <template #header>
            <h2>联系信息</h2>
          </template>
          <div class="info-item" v-for="info in contactInfo" :key="info.type">
            <h3 v-text="info.type"></h3>
            <p v-text="info.value"></p>
          </div>
        </AdvancedCard>
        
        <AdvancedCard class="contact-form-card">
          <template #header>
            <h2>发送消息</h2>
          </template>
          <AdvancedForm @submit="submitForm">
            <AdvancedFormItem label="姓名" required>
              <AdvancedInput v-model="form.name" placeholder="请输入您的姓名" />
            </AdvancedFormItem>
            
            <AdvancedFormItem label="邮箱" required>
              <AdvancedInput v-model="form.email" type="email" placeholder="请输入您的邮箱" />
            </AdvancedFormItem>
            
            <AdvancedFormItem label="消息" required>
              <AdvancedInput v-model="form.message" type="textarea" :rows="5" placeholder="请输入您的消息" />
            </AdvancedFormItem>
            
            <AdvancedFormItem>
              <AdvancedButton type="primary" :loading="form.loading">发送消息</AdvancedButton>
            </AdvancedFormItem>
          </AdvancedForm>
        </AdvancedCard>
      </div>
    </div>
    
    <div class="section">
      <h2 class="section__title">我们的位置</h2>
      <AdvancedCard>
        <div class="map-placeholder">
          <p>地图位置展示区域</p>
          <p>北京市朝阳区某某街道123号</p>
        </div>
      </AdvancedCard>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import AdvancedCard from '@/components/AdvancedCard.vue'
import AdvancedForm from '@/components/AdvancedForm.vue'
import AdvancedFormItem from '@/components/AdvancedFormItem.vue'
import AdvancedInput from '@/components/AdvancedInput.vue'
import AdvancedButton from '@/components/AdvancedButton.vue'

const contactInfo = ref([
  {
    type: '地址',
    value: '北京市朝阳区某某街道123号'
  },
  {
    type: '电话',
    value: '+86 138 0013 8000'
  },
  {
    type: '邮箱',
    value: 'contact@example.com'
  },
  {
    type: '工作时间',
    value: '周一至周五 9:00-18:00'
  }
])

const form = ref({
  name: '',
  email: '',
  message: '',
  loading: false
})

const submitForm = () => {
  form.value.loading = true
  // 模拟提交过程
  setTimeout(() => {
    form.value.loading = false
    alert(`感谢您的消息，${form.value.name}！我们将会尽快回复您。`)
    form.value = { name: '', email: '', message: '', loading: false }
  }, 1000)
}
</script>

<style scoped>
.contact {
  padding: 2rem 0;
}

.hero {
  text-align: center;
  margin-bottom: 3rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 3rem 1rem;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  animation: rotate 20s linear infinite;
}

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.hero h1 {
  font-size: 2.8rem;
  margin-bottom: 1rem;
  font-weight: 800;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.hero p {
  font-size: 1.3rem;
  max-width: 800px;
  margin: 0 auto;
  line-height: 1.6;
  opacity: 0.9;
}

.section {
  margin-bottom: 3rem;
  animation: fadeIn 0.6s ease-out;
}

.section__title {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 2rem;
  color: #2c3e50;
  position: relative;
}

.section__title::after {
  content: '';
  display: block;
  width: 60px;
  height: 4px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  margin: 0.8rem auto;
  border-radius: 2px;
}

.contact-info-card,
.contact-form-card {
  transition: all 0.3s ease;
  height: 100%;
}

.contact-info-card:hover,
.contact-form-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.info-item {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border-radius: 8px;
  background: #f8f9fa;
  transition: all 0.3s ease;
}

.info-item:hover {
  background: #e9ecef;
  transform: translateX(5px);
}

.info-item h3 {
  margin-top: 0;
  color: #2c3e50;
  font-size: 1.2rem;
  font-weight: 600;
}

.info-item p {
  margin: 0.5rem 0 0;
  color: #7f8c8d;
}

.map-placeholder {
  text-align: center;
  padding: 3rem;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 12px;
  transition: all 0.3s ease;
}

.map-placeholder:hover {
  transform: scale(1.02);
}

.map-placeholder p:first-child {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #2c3e50;
}

@media (max-width: 768px) {
  .hero h1 {
    font-size: 2.2rem;
  }
  
  .hero p {
    font-size: 1.1rem;
  }
  
  .section__title {
    font-size: 1.7rem;
  }
  
  .map-placeholder {
    padding: 2rem;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.8rem;
  }
  
  .hero p {
    font-size: 1rem;
  }
  
  .section__title {
    font-size: 1.5rem;
  }
  
  .map-placeholder {
    padding: 1.5rem;
  }
  
  .map-placeholder p:first-child {
    font-size: 1.1rem;
  }
}
</style>